import os

SOURCES = Split('''
    ast.cpp
    binder.cpp
    class_compiler.cpp
    codemodel.cpp
    codemodel_finder.cpp
    compiler_utils.cpp
    control.cpp
    declarator_compiler.cpp
    default_visitor.cpp
    lexer.cpp
    name_compiler.cpp
    parser.cpp
    tokens.cpp
    type_compiler.cpp
    visitor.cpp

    rpp/builtin-macros.cpp
    rpp/pp-main.cpp

    QtCore/qbytearray.cpp
    QtCore/qbytearraymatcher.cpp
    QtCore/qdatetime.cpp
    QtCore/qglobal.cpp
    QtCore/qhash.cpp
    QtCore/qlistdata.cpp
    QtCore/qlocale.cpp
    QtCore/qmap.cpp
    QtCore/qmetatype.cpp
    QtCore/qstring.cpp
    QtCore/qstringlist.cpp
    QtCore/qurl.cpp
    QtCore/qvariant.cpp
    QtCore/qvector.cpp
    QtCore/qvsnprintf.cpp
''')

PYTHON_SOURCES = Split('''
    python/ast.cpp
    python/codemodel.cpp
    python/parser.cpp
    python/preprocessor.cpp
    python/pyxx.cpp

    python/QtCore.cpp
''')


Import('env')

QT_ARCHS = {
    'posix' : 'QT_ARCH_I386',
    'nt' : 'QT_ARCH_WINDOWS',
}

env.Prepend(
    CPPPATH = ['.','QtCore/private','include', 'include/QtCore'],
    CPPDEFINES = ['BOOST_ALL_NO_LIB','RXX_ALLOCATOR_INIT_0', QT_ARCHS[os.name]]
)

if env['VARIANT'] == 'debug':
    env.Append( CPPDEFINES = ['BOOST_DEBUG_PYTHON'] )
    env['PDB'] = 'parser.pdb'

pyd = env.PyExtModule( 'parser', SOURCES + PYTHON_SOURCES )
Return('pyd')
